﻿package org.openChart.sprite
{
	import flash.events.MouseEvent;
	import org.openChart.sprite.BaseSprite;
	import org.openChart.sprite.CommandHandler;
	import org.openChart.sprite.MouseEventHandler;
	import org.openChart.display.DisplayBaseObject;
	import flash.display.Sprite;
	
	/**
	 * The base class of sprites which handle the mouse event.
	 * 
	 * @author Chongyuan
	 */
	public class MouseEventSprite extends BaseSprite implements MouseEventHandler
	{
		/**
		 * The constructor of mouse event sprite.
		 * 
		 * @param	displayObject
		 * @param	commandHandler
		 */
		public function MouseEventSprite( displayObject:DisplayBaseObject, commandHandler:CommandHandler) 
		{
			this.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
			this.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
			this.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove)
			this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
			this.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
			//this.addEventListener(MouseEvent.);
			super(displayObject, commandHandler);
		}
		
		/**
		 * To handle the mouse over event.
		 * @param	event
		 */
		public function mouseOver( event:MouseEvent):void
		{
			//trace("mouse over");
		}
		
		/**
		 * To handler the mouse out event. 
		 * @param	event
		 */
		public function mouseOut( event:MouseEvent):void
		{
			//trace("mouse out");
		}
		
		public function mouseMove( event:MouseEvent):void
		{
			//trace("mouse move");
		}
		
		public function mouseDown(event:MouseEvent):void
		{
			//trace("mouse down");
		}
		
		public function mouseUp(event:MouseEvent):void
		{
			//trace("mouse up");
		}
	}
	
}